/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package seGobangClient.configMenu;

import seGobangClient.GlobalController;
import seGobangClient.ICommand;
import seGobangClient.Options;
import seGobangClient.Rule;

/**
 *
 * @author yk
 */
public class CommandCommitOption implements ICommand{
 
   
    public Object execute(Object Param) {
        try{
            IConfigScene configui=(IConfigScene) GlobalController.getCurrentUISystem();
            Options op=new Options(configui.getGraphic_Message(),configui.getMusicVolum_Message(),configui.getSFXVolum_Message());
            Rule rl=new Rule(configui.getTimeLimit_Message(),configui.getRegretTimes_Message(),configui.getforbids_Message(),false);
            op.SaveToXML();
            rl.SaveToXML();
    
            GlobalController.setCurrentOptions(op);
            GlobalController.setCurrentRule(rl);
            GlobalController.setCurrentSceneController(
                   new seGobangClient.mainMenu.MainMenuController(
                   GlobalController.getCurrentUISystem()));
        }catch(Exception e){
            e.printStackTrace();
        }
       return null;
    }

    public Object undo() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
